<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>倒计时动画</title>
    <style>
        div{
            text-align:center;
            height:100px;
            line-height:100px;
            color: red;
        }
    </style>
    <script>
        window.onload = function(){
            setInterval(FreeTime2,1000);
        }

        function FreeTime2(){
            var curTime2 = Date.now();
            var endTime2 = new Date("2021-4-23 17:19:00");
            var startTime2=new Date("2021-4-23 17:17:00");
            var allFreeSeconds2 = (endTime2-curTime2)/1000;
            var go2=(curTime2-startTime2)/1000;
            if(go2<0){
                document.getElementById('b').innerHTML = "活动没开始";
            }else {
                if (allFreeSeconds2 < 0) {
                    document.getElementById('b').disabled = true;
                    document.getElementById('b').innerHTML = "活动已经结束";
                } else {
                    document.getElementById('b').disabled = false;
                    var freeDay2 = Math.floor(allFreeSeconds2 / (24 * 60 * 60));
                    var freeHour2 = Math.floor(allFreeSeconds2 / (60 * 60) % 24);
                    var freeMinute2 = Math.floor(allFreeSeconds2 / 60 % 60);
                    var freeSecond2 = Math.floor(allFreeSeconds2 % 60);
                    document.getElementById("b").innerHTML = "立即抢购";
                }
            }
        }
    </script>
</head>
<body>

<!--<button id="a" value="buke" style="width: 50px;height: 30px" onclick="a()" disabled="true">-->

    <button id="b" value="uneng " style="width: 100px;height: 50px" onclick="a()" disabled="true">
    </button>
<script>
    function a(){
        window.open("http://baidu.com")
    }
</script>
</body>

</html>

